public class J05BreakTest {
    public static void main(String[] args) {
        while (true){
            System.out.println("hello");
            //跳出循环，打破
            break;
        }
        System.out.println("end");

        //打印1-10,遇到5结束循环
        for (int i = 1; i <= 10; i++) {
            //1-5
            System.out.println("i = " + i);
            if(i==5){
                break;
            }
        }


    }
}
class ContinueTest{
    public static void main(String[] args) {
        //1-10，不要6
        for (int i = 1; i <= 10; i++) {
            if(i!=6){
                System.out.println("i = " + i);
            }
        }
        System.out.println("=====");
        for (int i = 1; i <= 10; i++) {
            if(i==6){
                //结束本次循环，继续下次循环
                continue;
            }
            System.out.println("i = " + i);
        }
        System.out.println("=====");
        //1-10，不要6
        int i = 1;
        while (i<=10){
            if(i==6){
                i++;
                continue;
            }
            //1,2,,,5
            System.out.println("i = " + i);
            i++;
        }
    }
}